﻿@model IEnumerable<trangbaocao.Models.StationsAssociateModel>        
<!--Body-->
<div align="center" style="margin-bottom:10px;"><h1>DANH MỤC NHÀ TRẠM</h1></div>
<div class="container_12">
    <div class="grid_12">
        <!-- Notification boxes -->
        @if (TempData["msg"] != null)
        {                            
            <span class="notification n-success">@TempData["msg"]</span>
        }
        @if (TempData["error"] != null)
        {                            
            <span class="notification n-error">@TempData["error"]</span>
        }  
        @using (Html.BeginForm("FindStations", "Stations", FormMethod.Post, new { id = "FindStations", name = "FindStations" }))
        {
            <div style="padding-left:5px; margin-bottom:5px; text-align:left; width:40%">
                   <lable style="margin-right:3px">Trung tâm: </lable>
                    @if (ViewBag.trungtam_id != null)
                    {                              
                        @Html.DropDownList("main_stations_id", ViewBag.trungtam_id as SelectList, "---Chọn trung tâm---")   
                            
                    }
            </div>
            <div class="bottom-spacing">
                <!-- Button -->
                <div class="float-right">
                    <a href="@Url.Action("AddStations", "Stations")" class="button">
                        <span>Thêm mới <img src="@Url.Content("~/Content/Body/Images/plus-small.gif")"  width="12" height="9" alt="Thêm mới" /></span>
                    </a>
                </div> 
                Tìm kiếm: 
                <select name="select_option" style="width:auto; margin-left:7px">
                    <option value="stations.ma_tram"  @(ViewBag.find_selectbox == "stations.ma_tram" ? "selected" : "") >Mã trạm</option>
                    <option value="stations.name"  @(ViewBag.find_selectbox == "stations.name" ? "selected" : "") >Tên nhà trạm</option>
                    
                </select>
                <input type="text" class="input-short" name="timkiem" value="@ViewBag.find_textbox" style="width:15%"/>
                <input class="submit-green" type="submit" value="Tìm kiếm"  style="width:8.5%"/>                
            </div> 
        }      
            <!-- Example table -->  
        @using (Html.BeginForm("CheckedAction", "Stations", FormMethod.Post, new { id = "CheckedAction", name = "CheckedAction" }))
        {                     
            <div class="module">
                <h2><span>@*Sample table*@</span></h2>                    
               @* <div class="module-table-body">
                    <table id="myTable" class="tablesorter">*@
                    <div class="module-table-body">
                        <div class="scrolling">
                            <div class="data-table" style="width:190%">
                                <table id="myTable" class="tablesorter">
                                    <thead>
                                        <tr>
                                            <th style="width:4%;">STT</th>
                                            <th style="width:4%;">Chọn</th>
                                            <th style="width:4%;">Xóa</th>
                                            <th style="width:4%;">Sửa</th>
                                            <th style="width:6%;">Mã trạm</th>
                                            <th style="width:12%;">Tên trạm</th>
                                            <th style="width:13%;">Địa chỉ</th>
                                            <th style="width:10%;">Trung tâm</th>
                                            <th style="width:9%;">Người quản lý</th>
                                            <th style="width:8.5%;">Số điện thoại</th>
                                            <th style="width:10%;">Ngày xây dựng</th>
                                            
                                            <th style="width:9%;">Ngày sử dụng</th>
                                            
                                        </tr>
                                    </thead>
                                 <tbody>
                        @{int stt = 0;}
                        @foreach (var item in Model)
                        {
                            stt++;
                            <tr>
                                <td class="align-center">@stt</td>
                                <td class="align-center"><input type="checkbox" name="Items" id="Items[]" value="@item.id"/></td>

                                <td class="align-center">
                                    <a href="@Url.Action("DeleteStations", "Stations", new { id = item.id })" onclick="return confirm('Bạn muốn xóa thông tin này?');" title="Xóa thông tin"><img src="@Url.Content("~/Content/Body/Images/cross-on-white.gif")" width="16" height="16" alt="delete" /></a> &nbsp;&nbsp;&nbsp;                                   	
                                    @*<a href="" title=""><img src="../../Content/Body/Images/tick-circle.gif"  width="16" height="16" alt="published" /></a>*@
                                </td>
                                <td class="align-center">
                                    <a href="@Url.Action("EditStations", "Stations", new { id = item.id })" title="Sửa thông tin"><img src="@Url.Content("~/Content/Body/Images/pencil.gif")"  width="16" height="16" alt="edit" /></a>
                                    @*<a href=""><img src="../../Content/Body/Images/balloon.gif" width="16" height="16" alt="comments" /></a>*@
                                    @*<a href="@Url.Action("DeleteStations", "Stations", new { id = item.id })" onclick="return confirm('Bạn muốn xóa thông tin này?');" title="Xóa thông tin"><img src="../../Content/Body/Images/bin.gif" width="16" height="16" alt="delete" /></a>*@                                </td>
                                @*<td class="align-center"><input type="checkbox" name="Items" id="Items[]" value="@item.user_name"/></td>*@
                                
                                <td> @Html.DisplayFor(modelItem => item.ma_tram)</td>
                                <td> @Html.DisplayFor(modelItem => item.name)</td>
                                <td> @Html.DisplayFor(modelItem => item.dia_chi)</td>
                                <td> @Html.DisplayFor(modelItem => item.main_stations_name)</td>
                                <td> @Html.DisplayFor(modelItem => item.nguoi_quan_ly)</td>
                                <td> @Html.DisplayFor(modelItem => item.so_dien_thoai)</td>
                                <td> @Html.DisplayFor(modelItem => item.ngay_xay_dung)</td>
                                
                                <td> @Html.DisplayFor(modelItem => item.ngay_su_dung)</td>
                                
                            </tr>
                        }   
                        </tbody>
                    </table>
                    </div></div>
                    <div class="pager" id="pager">
                        <div>
                        <img class="first" src="@Url.Content("~/Content/Body/Images/arrow-stop-180.gif")"  alt="first"/>
                        <img class="prev" src="@Url.Content("~/Content/Body/Images/arrow-180.gif")" alt="prev"/> 
                        <input type="text" class="pagedisplay input-short align-center"/>
                        <img class="next" src="@Url.Content("~/Content/Body/Images/arrow.gif")" alt="next"/>
                        <img class="last" src="@Url.Content("~/Content/Body/Images/arrow-stop.gif")" alt="last"/>
                        <select class="pagesize input-short align-center">
                            <option value="20" selected="selected">20</option>
                            <option value="30">30</option>
                            <option value="40">40</option>
                        </select>
                        </div>
                    </div>
                    <div class="table-apply"> 
                        <div class="float-right">
                            <a style='cursor:pointer' onclick="return CheckItem();" class="button">
                                <span>Xóa chọn</span>
                            </a>
                        </div>                  
                                              
                    </div>
                    <div style="clear: both"></div>
                </div> <!-- End .module-table-body -->
            </div> <!-- End .module --> 
        }                                                                    
	</div> <!-- End .grid_12 -->            
    <div style="clear:both;"></div>            
</div> <!-- End .container_12 -->
<!----------------------------------------------------------------->
<script language="javascript" type="text/javascript">
    function CheckItem() {
        var arrCheckboxes = document.getElementsByName('Items');
        var checkCount = 0;
        for (var i = 0; i < arrCheckboxes.length; i++) {
            checkCount += (arrCheckboxes[i].checked) ? 1 : 0;
        }
        if (checkCount > 0) {
            if (confirm("Bạn chắc chắn muốn xóa thông tin đã chọn?"))
                document.forms["CheckedAction"].submit();
        } else {
            alert("Bạn chưa chọn thông tin cần xóa!");
            return false;
        }
    }
</script>

    

           

	